﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TTSModel;
using TTSIDAL;
using System.Data.SqlClient;
using System.Data;

namespace TTSDAL
{
    public class TestStatus : BaseRepository<TestStatusInfo>, ITestStatus
    {
         #region 静态变量定义
        private const string PARM_ASSEMBLE_ID = "@ID";
        private const string PARM_ASSEMBLE_SN = "@SN";

        #endregion

        #region 数据检索部分
        public IList<TestStatusInfo> LoadEntities()
        {
            return null;
        }
        public TestStatusInfo LoadEntity<T1>(T1 id)
        {
            return null;
        }

        public TestStatusInfo GetStatusbySN(string sn,string procedure)
        {
            SqlParameter parm = new SqlParameter(PARM_ASSEMBLE_SN, SqlDbType.NVarChar, 50);
            parm.Value = sn;
            return ExcuteSqlToGetEntity(procedure, parm);
        }
     
        #endregion

        #region 重写基类方法
        public override TestStatusInfo GetEntityRecord(SqlDataReader rdr)
        {
            TestStatusInfo entity = new TestStatusInfo()
            {
               status = rdr.GetValue(0).ToString()
            };
            return entity;
        }

        public override TestStatusInfo GetEntityRecord()
        {
            TestStatusInfo entity = new TestStatusInfo();
            return entity;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter parm = new SqlParameter(PARM_ASSEMBLE_ID, SqlDbType.Int, 4);
            return parm;
        }

        public override SqlParameter[] GetParameters()
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter(PARM_ASSEMBLE_ID,SqlDbType.Int,4),
                new SqlParameter(PARM_ASSEMBLE_SN,SqlDbType.NVarChar,50),
            };
            return parms;
        }

        public override void SetParameters(TestStatusInfo Entity, params SqlParameter[] Parms)
        {
            Parms[0].Value = Entity.status;
        }
        #endregion
    
    }
}
